package com.chenliang.controller;

import com.chenliang.domain.SysLog;
import com.chenliang.service.ISysLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Insert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @ProjectName: mavenSSM
 * @Package: com.chenliang.controller
 * 作用：
 */
@Controller
@RequestMapping("/sysLog")
public class SysLogController {
@Autowired
private ISysLogService service;
    @RequestMapping("/findAll")
    public String findAll(Model model,
              @RequestParam(name = "page",defaultValue = "1",required = true)Integer page,
              @RequestParam(name = "pageSize",defaultValue = "4",required = true)Integer pageSize){

       List<SysLog> sysLogs= service.findAll(page,pageSize);
        PageInfo pageInfo=new PageInfo(sysLogs);
model.addAttribute("pageInfo",pageInfo);
        return "syslog-list";
    }
}
